#pragma once
class ObjMesh;
class DAEFloat3;

#include <vector>
using namespace std;
#include <map>
#include "DAEFloat3.h"
#include "util.h"

/**
* Container for individual meshes.
* @author Koen Samyn
*/ 
class MeshList
{
public:
	/**
	* Creates a new MeshList object.
	*/ 
	MeshList(void);
	/**
	* Destroys the MeshList object.
	*/
	virtual ~MeshList(void);
	/**
	* Adds a new Mesh to the list.
	* @param mesh the mesh to add.
	*/
	void AddMesh(ObjMesh* mesh);
	/**
	* Sets the centerpoint for the meshlist.
	* @param centerPoint the center point.
	*/
	void SetCenterPoint(DAEFloat3 centerPoint){m_CenterPoint = centerPoint;}
	/**
	* Sets the height for this meshlist.
	* @param height the new height
	*/
	void SetHeight(float height){m_Height = height;}
	/**
	* Returns the size of this meshlist.
	* @return the number of submeshes.
	*/
	size_t Size(){return m_Meshes.size();}
	/**
	* Returns the begin of the mesh list.
	* @return the begin (const iterator).
	*/
	vector<ObjMesh*>::const_iterator begin() const{
		return m_Meshes.begin();
	}
	/**
	* Returns the end of the mesh list.
	* @return the end (const iterator)
	*/
	vector<ObjMesh*>::const_iterator end() const{
		return m_Meshes.end();
	}
	/**
	* Sets the source of this mesh list.
	* @param source the source of the mesh list.
	*/
	void SetSource(tstring source){m_Source = source;}
	/**
	* Gets the source of the mesh list.
	* @return the source of the mesh list.
	*/
	tstring GetSource(){return m_Source;}
	/**
	* Returns a sub object of this meshlist or NULL if the 
	* subobject was not found.
	*/
	ObjMesh* GetSubObject(const tstring& name)const;
	/**
	* Returns the first mesh in the list.
	* @return the first mesh object in the list.
	*/
	ObjMesh* GetFirstMesh()const;
	
private:
	/**
	* A vector that contains the meshes.
	*/
	vector<ObjMesh*> m_Meshes;
	/**
	* A map with the mesh names and the meshes themselves.
	*/
	map<tstring, ObjMesh*> m_MeshMap;
	/**
	* The centerpoint for the mesh list.
	*/
	DAEFloat3 m_CenterPoint;
	/**
	* The height for the mesh list.
	*/
	float m_Height;
	/**
	* The source for this meshlist, so it can be reloaded.
	*/
	tstring m_Source;
};
